//
//  YiBanInfoVC.m
//  LaSaCivilAffairsDepartment
//
//  Created by 姜晓延 on 2019/8/22.
//  Copyright © 2019 wpkj. All rights reserved.
//

#import "YiBanInfoVC.h"

@interface YiBanInfoVC ()

@end

@implementation YiBanInfoVC

- (void)viewDidLoad {
    [super viewDidLoad];
   [self makeViewWithDict:self.dict];
    self.title = @"详情";
    // Do any additional setup after loading the view.
}
#pragma  mark 查看

- (void)makeViewWithDict:(NSDictionary*)dict{
    UIScrollView *scrollVIew = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight-SafeAreaTopHeight)];
    [self.view addSubview:scrollVIew];
    NSArray *values = @[[NSString stringWithFormat:@"%@",[ValidateUtils validateNull:dict[@"bpmBizTitle"]]],[NSString stringWithFormat:@"%@",[ValidateUtils validateNull:dict[@"procDefId"]]],[NSString stringWithFormat:@"%@",[ValidateUtils validateNull:dict[@"procDefName"]]],[NSString stringWithFormat:@"%@",[ValidateUtils validateNull:dict[@"procInstId"]]],[NSString stringWithFormat:@"%@",[ValidateUtils validateNull:dict[@"name"]]],[NSString stringWithFormat:@"%@",[ValidateUtils validateNull:dict[@"startRealName"]]],[NSString stringWithFormat:@"%@",[ValidateUtils validateNull:dict[@"assigneeRealName"]]],[NSString stringWithFormat:@"%@",[ValidateUtils validateNull:dict[@"startTime"]]],[NSString stringWithFormat:@"%@",[ValidateUtils validateNull:dict[@"endTime"]]],[NSString stringWithFormat:@"%@",[ValidateUtils validateNull:dict[@"durationStr"]]]];
    NSArray *names = @[@"标题：",@"流程编号：",@"流程名称：",@"流程实例：",@"任务名称：",@"任务发起人：",@"任务办理人：",@"开始时间： ",@"结束时间：",@"持续时间："];
    CGFloat maxY = 0;
    for (NSInteger i = 0; i < names.count; i++) {
        UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, maxY, ScreenWidth, 50)];
        view.backgroundColor = hexColor(ffffff);
        [scrollVIew addSubview:view];
        
        
        UILabel *titlelabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 100, 30)];
        titlelabel.font = [UIFont systemFontOfSize:15];
        titlelabel.textColor = hexColor(333333);
        [view addSubview:titlelabel];
        titlelabel.text = names[i];
        
        UITextField *textFiled = [[UITextField alloc]initWithFrame:CGRectMake(10+80+20, 10, ScreenWidth-10-90-20, 30)];
        textFiled.textColor = hexColor(666666);
        textFiled.font = [UIFont systemFontOfSize:15];
        [view addSubview:textFiled];
        textFiled.userInteractionEnabled = NO;
        textFiled.text = values[i];
        
        UIView *lineViwe = [[UIView alloc]initWithFrame:CGRectMake(0, 49, ScreenWidth, 1)];
        lineViwe.backgroundColor = hexColor(f0f0f0);
        [view addSubview:lineViwe];
        maxY = CGRectGetMaxY(view.frame);
        
        if (i == 7 || i == 8) {
           if ([ValidateUtils validateNull:values[i]].length > 10) {
           NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
           [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
           NSDate *date = [NSDate dateWithTimeIntervalSince1970:[[values[i] substringToIndex:10] integerValue]];
           
           textFiled.text = [dateFormatter stringFromDate:date];
       }
        }
    }
    
    scrollVIew.contentSize = CGSizeMake(0, maxY+10);
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
